/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import Server.BUS.StringUlti;
import Server.DTO.SelectNoWhereQuery;
import org.junit.*;
import static org.junit.Assert.*;

/**
 *
 * @author Trung
 */
public class SelectNoWhereQueryTest {
    
    public SelectNoWhereQueryTest() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }
    
    @Before
    public void setUp() {
    }
    
    @After
    public void tearDown() {
    }

    @Test
    public void testSelectNoWhereQueryContructor1() {
        // TODO review the generated test code and remove the default call to fail.
        String queryString = "    SELECT    *    FROM    TableA   ";
        queryString = StringUlti.formatString(queryString);
        
        SelectNoWhereQuery snq = new SelectNoWhereQuery(queryString);
        
        assertTrue(snq.queryString.equalsIgnoreCase(queryString));
        assertTrue(snq.keyWord.equalsIgnoreCase("SELECT_NOWHERE"));
        assertTrue(snq.selectString.equalsIgnoreCase("*"));
        assertTrue(snq.fromString.equalsIgnoreCase("TABLEA"));
    }
    
    @Test
    public void testSelectNoWhereQueryContructor2() {
        // TODO review the generated test code and remove the default call to fail.
        String queryString = "SELECT * FROM TableA";
        queryString = StringUlti.formatString(queryString);
        
        SelectNoWhereQuery snq = new SelectNoWhereQuery(queryString);
        
        assertTrue(snq.queryString.equalsIgnoreCase(queryString));
        assertTrue(snq.keyWord.equalsIgnoreCase("SELECT_NOWHERE"));
        assertTrue(snq.selectString.equalsIgnoreCase("*"));
        assertTrue(snq.fromString.equalsIgnoreCase("TABLEA"));
    }
    
    @Test
    public void testSelectNoWhereQueryContructor3() {
        // TODO review the generated test code and remove the default call to fail.
        String queryString = "SELECT ID, NAME FROM TableA";
        queryString = StringUlti.formatString(queryString);
        
        SelectNoWhereQuery snq = new SelectNoWhereQuery(queryString);
        
        assertTrue(snq.queryString.equalsIgnoreCase(queryString));
        assertTrue(snq.keyWord.equalsIgnoreCase("SELECT_NOWHERE"));
        assertTrue(snq.selectString.equalsIgnoreCase("ID, NAME"));
        assertTrue(snq.fromString.equalsIgnoreCase("TABLEA"));
    }
    
    @Test
    public void testSelectNoWhereQueryContructor4() {
        // TODO review the generated test code and remove the default call to fail.
        String queryString = "    SELECT ID, NAME    FROM    TableA   ";
        queryString = StringUlti.formatString(queryString);
        
        SelectNoWhereQuery snq = new SelectNoWhereQuery(queryString);
        
        assertTrue(snq.queryString.equalsIgnoreCase(queryString));
        assertTrue(snq.keyWord.equalsIgnoreCase("SELECT_NOWHERE"));
        assertTrue(snq.selectString.equalsIgnoreCase("ID, NAME"));
        assertTrue(snq.fromString.equalsIgnoreCase("TABLEA"));
    }
    
}
